home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / comm / bbs / FilePather13.lha / FilePather / Docs / Tricks.txt < prev    next >
Encoding:
Text File  |  1995-04-07  |  5.4 KB  |  140 lines

  1.  
  2.  
  3.                 Tricks!
  4.                 -------
  5.  
  6.     Some ideas and hints when using the FilePather programs.
  7.  
  8.  Index
  9.  -----
  10.  
  11.   1. Archivers
  12.   2. Save RAM
  13.   3. Using the Notify mode
  14.  
  15.  1. Archivers
  16.  ------------
  17.  
  18.     Since FilePather has such a flexible way of configuration, it's
  19.  possible to detect and process all types of files which have a specific
  20.  suffix. However, some archivers are unable to extract/update the archive
  21.  in the same easy way LhA does.
  22.  
  23.  Since it from version 1.2 of FilePather is possible to execute more than
  24.  one command from the environment variable string, some new interesting
  25.  ways opens up. Some examples:
  26.  
  27.  A.  The 'Shrink' archiver adds the temporary directory where in
  28.  FilePath.lst resides. Solution:
  29.  ------------------------------------------------------------------------
  30.  Set Arc `List "%f" LFORMAT %%f%%s`
  31.  Cd "%t/"
  32.  Shrink -q -p -d aa "$Arc" FilePath.lst
  33.  ------------------------------------------------------------------------
  34.  1. Remember the full searchpath for the archive under processing.
  35.      '%%' is used since FilePather tries to convert percent signs to
  36.      strings! The command inside `` is executed before the real command
  37.      line and the output is placed as input in its place.
  38.  2. Change directory to the temporary one.
  39.  3. Update the archive which path $Arc contain, with the FilePath.lst file
  40.      which is in our current directory.
  41.  
  42.  B.  'Zoo' can't extract to a directory. Solution:
  43.  ------------------------------------------------------------------------
  44.  Set Arc `List "%f" LFORMAT %%f%%s`
  45.  Cd "%t/"
  46.  Zoo x "$Arc" FilePath.lst
  47.  ------------------------------------------------------------------------
  48.  1. Remember full searchpath.
  49.  2. Change to temporary directory.
  50.  3. Extract to current directory.
  51.  
  52.  
  53.  This way it's possible to use any archiver who can extract and update
  54.  an archive. An golden exception is DMS/FMS which in it's impossible to
  55.  delete or overwrite an existing file! All versions I have tested only
  56.  adds the file without testing whether the file already exists in the
  57.  archive or not! Lousy programming I might say.
  58.  
  59.  
  60.  NOTE! Some archivers supports that a custom configuration is stored in
  61.  NOTE! an environment variable. LhA for example looks for the variable
  62.  NOTE! 'LHAOPTS'. Please make sure that no commands or options in this
  63.  NOTE! variable interferes with those in the extract/update variable for
  64.  NOTE! that archiver! Ie, if you have set LHAOPTS to '-r' (Collect files
  65.  NOTE! recursively) when you must disable this in the the update variable
  66.  NOTE! for .lha, adding '-r0'!   (BTW, this one is already fixed.)
  67.  
  68.  
  69.  2. Save RAM
  70.  -----------
  71.  
  72.     Since FilePather stores all it's preferences as environment variables
  73.  the memory usage can be awful big. My FilePather directory takes up a
  74.  chocking 48kb! Although the files are small occupies each file atleast
  75.  2kb of memory.
  76.  
  77.  The solution? Well, there are two ways. Either you assign ENV: to an
  78.  empty directory early in the startup procedure, which will save LOTS
  79.  of RAM, or you move ENVARC:FilePather/#? to another directory and
  80.  notifies FilePather and FPBase by setting a singel environment
  81.  variable, 'FP_PrefsDir', with the path to the directory. Ie:
  82.  
  83.   Makedir S:FilePather
  84.   Copy ENVARC:FilePather/#? S:FilePather
  85.   SetEnv ENVARC:FP_PrefsDir S:FilePather/
  86.   Delete ENVARC:FilePather/#?
  87.   Delete ENVARC:FilePather
  88.  
  89.  NOTE! If you perform the above description, the installer script will not
  90.  be able to locate your prefsfiles! Sorry about that! Maybe I fix this
  91.  later, but unfortunately there are some obstacles. :(
  92.  
  93.  BTW: there is another possiblity: the system first check if it exists
  94.  a local variable, before it have a go at the global ones. Local
  95.  variables are set through the 'Set' command, unlike the global ditos
  96.  which are set by 'SetEnv'. The local variable uses much less memory,
  97.  but might be hard to use when some programs, DiskMaster among others,
  98.  somehow manage to 'forget' all local variables, paths etc.
  99.  
  100.  
  101.  3. Using the Notify mode
  102.  ------------------------
  103.  
  104.     The notify mode can be used if no other alternatives exists, ie it's
  105.  not possible to autoprocess up- or downloaded files in any other way.
  106.  
  107.  To use Notify mode you just specify a directory name together with the
  108.  switch 'NOTIFY' on the commandline:
  109.  
  110.   FilePather DATA:Tmp_DL/ Notify
  111.  
  112.  BUT! Since the file will only be processed by FilePather, not moved
  113.  anywhere, will the file be processed each time a file is up- or downloaded!
  114.  The result is a huge FilePath.lst. If you instead specifies this:
  115.  
  116.   FilePather DATA:Tmp_DL/ Notify NextCommand 'Rename "%f" DATA:Download/'
  117.  
  118.  This way will the file be moved after the processing by FilePather.
  119.  You can't ofcourse rename across devices, that is a limitation of the OS.
  120.  However, if you are in the possession of a Move command, consider using
  121.  that instead.
  122.  
  123.  There is one drawback using this method: neither Rename or any Move command
  124.  will over-write an existing file! And the result will be just what we wanted
  125.  to aviod: a huge FilePath.lst. So? What to do?! Here's a simple trick:
  126.  Use the environment variable 'NextCommand' to specifying the above command
  127.  line together with this:
  128.  
  129.  -8<------------------------------------------------------------------
  130.  FailAt 21
  131.  Rename "%f" DATA:Download/ >NIL:
  132.  If ERROR
  133.     Rename "%f" DATA:Dupes/ >NIL:
  134.  Endif
  135.  -8<------------------------------------------------------------------
  136.  
  137.  This will ofcourse not protect against a THIRD file with the same name,
  138.  but the possibility for this is ofcourse quite small.
  139.  
  140.